<?php

namespace app\vip_agent\controller;


use think\Session;

class Other extends Base
{
    //
    public function extension()
    {
        $id=Session::get('user.id');
        $code=createCode($id);
        $url=Website.'/home/userregister/index?refereecode='.$code;
        $qrcode = $this->scerweima($url);
        return view('other/extension',['url'=>$url,'qrcode'=>$qrcode]);
    }

    public function scerweima($url=''){
        require_once EXTEND_PATH.'phpqrcode/phpqrcode.php';

        $value = $url;                  //二维码内容

        $errorCorrectionLevel = 'L';    //容错级别
        $matrixPointSize = 5;           //生成图片大小

        //生成二维码图片
        $filename = '/static/vip_agent/qrcode/'.microtime().'.png';
        $path=ROOT_PATH.'/public/'.$filename;
        \QRcode::png($value,$path , $errorCorrectionLevel, $matrixPointSize, 2);

        return $filename;

    }
}
